package com.prd.controller;

import com.prd.dto.BudgetApproveDto;
import com.prd.dto.DeviationDto;
import com.prd.model.EntMeetSummaryApprove;
import com.prd.model.EntMeetSummaryBudget;
import com.prd.service.EntMeetSummaryBudgetService;
import com.prd.util.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "会议预算/实际/差异投入")
@RestController
@RequestMapping("/api/entMeetSummaryBudget")
public class EntMeetSummaryBudgetController extends BaseController {

    @Autowired
    private EntMeetSummaryBudgetService entMeetSummaryBudgetService;

    @ApiOperation("添加预算/实际/差异/追加预算投入")
    @PostMapping(value = "addBudget", produces = "application/json;charset=UTF-8")
    public AjaxResult addBudget(@RequestBody EntMeetSummaryBudget entMeetSummaryBudget) {
        return toAjax(entMeetSummaryBudgetService.insertInfo(entMeetSummaryBudget));
    }

    @ApiOperation("添加预算审批人信息")
    @PostMapping(value = "addBudgetApprove", produces = "application/json;charset=UTF-8")
    public AjaxResult addBudgetApprove(@RequestBody BudgetApproveDto budgetApproveDto) {
        return toAjax(entMeetSummaryBudgetService.addBudgetApprove(budgetApproveDto));
    }

    @ApiOperation("添加预算误差报告信息")
    @PostMapping(value = "addDeviation", produces = "application/json;charset=UTF-8")
    public AjaxResult addDeviation(@RequestBody DeviationDto deviationDto) {
        return toAjax(entMeetSummaryBudgetService.addDeviation(deviationDto));
    }

    @ApiOperation("查询会议决议预算审批人员权限")
    @GetMapping(value = "jurisdictionBudget/{summaryId}", produces = "application/json;charset=UTF-8")
    public AjaxResult jurisdictionBudget(@PathVariable Long summaryId) {
        return AjaxResult.success(entMeetSummaryBudgetService.jurisdictionBudget(summaryId));
    }

    @ApiOperation("查询会议预算信息")
    @GetMapping(value = "listBudget/{summaryId}", produces = "application/json;charset=UTF-8")
    public AjaxResult listBudget(@PathVariable Long summaryId) {
        return AjaxResult.success(entMeetSummaryBudgetService.listBudget(summaryId));
    }

    @ApiOperation("添加预决算意见/通过/不通过信息")
    @PostMapping(value = "addApprove", produces = "application/json;charset=UTF-8")
    public AjaxResult addApprove(@RequestBody EntMeetSummaryApprove entMeetSummaryApprove) {
        return toAjax(entMeetSummaryBudgetService.addApprove(entMeetSummaryApprove));
    }
}
